package com.qfedu.buy.server.controller;

import com.qfedu.buy.common.config.SystemConfig;
import com.qfedu.buy.common.dto.SkillOrderAddDto;
import com.qfedu.buy.common.vo.R;
import com.qfedu.buy.server.service.intf.SkillOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;

/**
 * @program: NeighborBuy
 * @description:
 * @author: Feri(邢朋辉)
 * @create: 2021-02-05 09:41
 */
@RestController
@RequestMapping("/server/skill/")
public class SkillOrderController {
    @Autowired
    private SkillOrderService service;

    @PostMapping("/skillpath.do")
    public R skill(int gid,HttpServletRequest request){
        //通过商品id和用户id 实现加密生成密文串码
        return service.getpath(request.getIntHeader(SystemConfig.USER_ID),gid);
    }

    @PostMapping("/{path}/save.do")
    public R save(@RequestBody SkillOrderAddDto dto, @PathVariable String path, HttpServletRequest request){
        return service.saveOrderV2(request.getIntHeader(SystemConfig.USER_ID),path,dto);
    }
}